<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Excel 上传</title>
<style>
.cl{width:95%; margin:60px auto;}
.ans{ width:1200px; margin:60px auto;}
</style>
    <script src="/cn/js/jquery-1.12.2.min.js"></script>
<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
<!-- 编辑器公式插件 -->
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/addKityFormulaDialog.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/getKfContent.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/defaultFilterFix.js"></script>
<script type="text/javascript" src="/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<input type="text" value="<input/>">
<div id="wrapper" class="cl">
    <form action="">
        <div class="controls">
            百度编辑
            <textarea  id="editor" class="editor"
            name="value"></textarea>
            <script>var editor = UE.getEditor('editor');</script>
            <input type="hidden" name="kye" value="">
        </div>
        <button type="button" class="update">开始生成</button>
    </form>
</div>
<div  class="ans">
    原格式输出内容
<div>

<script type="text/plain" id="j_ueditorupload"></script>
</body>
</html>

<script>

$(".update").click(function(){

    // 带格式
    var text = editor.getContent();
    if(text){
        var reg = /style=\"(.*?)\"/gi;
        var reg2 = /class=\"(.*?)\"/gi;
        text = text.replace(reg,'');
        text = text.replace(reg2,'');
        text = text.replace(/<input(.*?)\/>/ig,'<input/>');
        text = text.replace(/<div(.*?)>/ig,'<div>');
        text = text.replace(/<p(.*?)>/ig,'<p>');
        text = text.replace(/<span(.*?)>/ig,'<span>');
        $('.ans').text(text);
    }
});
</script>
<script>
//实例化编辑器
var o_ueditorupload = UE.getEditor('j_ueditorupload',
    {
        autoHeightEnabled: false
    });
o_ueditorupload.ready(function () {

    o_ueditorupload.hide();//隐藏编辑器

    o_ueditorupload.addListener('afterUpfile', function (t, arg) {
        $('.file').val(arg[0].url);
    });
});

// 弹出文件上传的对话框
function upFiles() {
    var myFiles = o_ueditorupload.getDialog("attachment");
    myFiles.open();
}
</script>



